package com.luoc.base.model;

import lombok.Data;

/**
 * @Author: luoc
 * @Date: 2019/7/4 15:20
 */
@Data
public class Result {

    /**
     * 返回接口code 码
     */
    private String msgCode;

    /**
     * 返回信息提示
     */
    private String message;

    /**
     * 返回参数
     */
    private Object data;


    public static Result ok(Object data) {
        Result result = new Result();
        // 可以抽象出作为一个常量code类
        result.setMessage("成功");
        result.setMsgCode("200");
        result.setData(data);
        return result;
    }

    public static Result error(String message) {
        //return new OutPutDto("500","请")
        Result result = new Result();
        result.setMsgCode("500");
        result.setMessage(message);
        return result;
    }

    public Result() {
    }

    public Result(String msgCode, String message, Object data) {
        this.msgCode = msgCode;
        this.data = data;
        this.message = message;
    }
}